package com.aSemy.qotwReader.core.parseInput.exceptions;

import com.aSemy.qotwReader.core.parseInput.Command;

/**
 * This exception is thrown when an unknown argument to a command was found while parsing the commands.
 * @author Adam Semenenko
 */
public class UnknownArgumentException extends Exception
{
    /** Eclipse made me do this I don't know what it does but it stops Eclipse from complaining. */
    private static final long serialVersionUID = 346305698576749489L;
    
    /**
     * If command doesn't have a valid argument. The exception's message contains the argument, the command, and lists valid commands.
     * @param arg The argument given (which is not valid).
     * @param cmd The command which was given the invalid argument.
     */
    public UnknownArgumentException(String arg, Command cmd)
    {
        super(
                "Unknown command ('" + arg + "') given to command " + cmd.getCommandString() + "\n" +  
                "Valid commands are \n" +
                cmd.getValidArgsString()
        );
    }
}
